<template>
  <div class="goods-sale">
    <BBEchart :options="options" width="500px" height="400px"></BBEchart>
  </div>
</template>

<script lang='ts'>
import { computed, defineComponent } from "vue";
import BBEchart from "@/base-ui/echart/index";
export default defineComponent({
  components: {
    BBEchart,
  },
  props: {
    data: {
      type: Array,
    },
    dataAxis: {
      type: Array,
      default: () => [],
    },
    title:{
      type:String,
      dafault:'数据量'
    }
  },
  setup(props) {
    const options = computed(() => {
      return {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: [
          {
            type: "category",
            data: props.dataAxis,
            axisTick: {
              alignWithLabel: true,
            },
          },
        ],
        yAxis: [
          {
            type: "value",
          },
        ],
        series: [
          {
            name: props.title,
            type: "bar",
            barWidth: "60%",
            data:props.data
          },
        ],
      };
    });

    return {
      options,
    };
  },
});
</script>

<style>
</style>